package com.personal.system.listener;

import cn.hutool.extra.spring.SpringUtil;
import com.personal.system.entity.WorkflowExample;
import com.personal.system.service.act.WorkflowExampleService;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.Expression;

public class MyTaskListener implements ExecutionListener {

    private Expression state;

    @Override
    public void notify(DelegateExecution delegate) {
        WorkflowExampleService bean = SpringUtil.getBean(WorkflowExampleService.class);
        WorkflowExample example = new WorkflowExample();
        example.setId(delegate.getProcessInstanceBusinessKey());
        example.setStatus("END");
        bean.updateWorkflowExample(example);
    }
}
